Computer graphics is the art and science of generating pictures, images, or other graphical or pictorial information with a computer. Generation of the pictures or images is commonly called rendering. Generally, in three-dimensional (3D) computer graphics, geometry that represents surfaces (or volumes) of objects in a scene is translated into pixels (picture elements), stored in a frame buffer, and then displayed on a display device.
In rendering a picture or image, an object undergoes various processing through various stages of a pipeline while progressing through various coordinate systems, often referred to as spaces. Referring to FIG. 1, the rendering process 10 is shown broadly as progressing from model space 102, to world space 104, to view space 106, to clip space 108, and then to screen space 110. In some implementations, the process may circumvent the world spaces 104 and skip directly from model space 102 to view space 106. Briefly, the model space 102 represents an original coordinate system whereby the particular object to be included in a displayed scene has not been transformed. The model space 102 provides a forum by which the user can manipulate an object on a screen through the use of model transforms. The user may seek to orient or align the object in various manners, shapes, and/or sizes with the help of a user interface to a computer monitor. That is, through a user interface, the user can direct a host processor to perform modifications via various model transforms applied to the object or model, with the result that the model space 102 has evolved to the world space 104.
From the world space 104, further transforms (e.g., view transforms) are applied to the vertices of the transformed object to facilitate projection and clipping, hence evolving into the view space 106. In the view space 106 (also called camera space), various functions take place, such as adding or modifying lighting and/or shading, trivial rejection, and creating a view volume, that enable a determination of what objects can be viewed by the camera and what objects cannot be viewed by the camera. For instance, a view frustum that comprises near and far clipping planes is typically created. Objects of a rendered 3-D scene that do not fit between the near and far clip planes and the sides of the frustum are omitted from processing, hence reducing clipping operations.
In the clip space 108, the coordinates of the frustum created in the view space 106 are normalized (e.g., via a perspective divide) to simplify clipping complexity, and then clipping is performed.
Once the clipping is performed, the primitives within the view volume are mapped to screen space 110 and rendered on a display device. Note that in some implementations, the various aforementioned processes may take place in different and/or additional spaces.
Referring to the clip space 108, various techniques are employed to reduce the number of primitives (e.g., triangles) that need to be clipped. One technique often used is referred to as guard band clipping. In guard band clipping, the near and far clipping planes created in the view space 106 remain unchanged, but the clipping frustum is extended beyond a desired viewport. That is, overall, two frusta are created: a guard band frustum and the smaller viewport frustum. Conditions for rendering and clipping may be implemented according to the following approach. If triangles are located outside the viewport, they are completely discarded. Additionally, triangles are rendered without clipping if within the viewport. Further, clipping is to be implemented if triangles cross both the viewport and guard band frustum or if the triangles cross the near and far clipping planes.
Though guard band clipping offers a conservative approach to rendering (e.g., more triangles may be passed than are needed at rasterization), that conservatism is balanced by a reduction in clipping operations. That is, guard band clipping reduces how often the host processor (e.g., central processing unit or CPU) performs clipping by accepting triangles that are partly off-screen, allowing the host processor to perform simpler and faster culling and clip tests in most cases. Nevertheless, when triangles are to be clipped, the process is arduous and hence time consuming. In conventional systems, clipping is typically performed via execution of one of many different algorithms (e.g., Cohen-Sutherland, Sutherland-Hodgman, Weiler-Atherton, Patrick Gilles Maillot, etc.) on a host processor. Such algorithms often require full sorting (e.g., of view frustum clipping codes), the determination of intersections with view volume clipping planes, and the interpolation of each parameter (e.g., alpha, fog, etc.) of the vertex, which can collectively be a computationally intensive approach that does not map well onto hardware.